//
//  TZWNetWorkTool.swift
//  Sinaweibotzw
//
//  Created by 檀志文 on 16/4/11.
//  Copyright © 2016年 ios檀志文. All rights reserved.
//

import UIKit

import AFNetworking

enum TZWNetWorkToolEnum: Int {
    case AccessTokenEmpty = -1
    case UidEmpty = -2

    var errorDescription: String {
    get {
        switch self {
        case AccessTokenEmpty: return "access_token没有值"
        case UidEmpty: return "uid没有值"
        }
    }
}
//    返回一个错误
    func error() ->NSError {
        return NSError(domain: "cn.itheima.net", code: self.rawValue, userInfo: ["errorDescription" : self.errorDescription])
    }
    
}

class TZWNetWorkTool: AFHTTPSessionManager {
 /// 创建一个网络请求的单例
    
    static let NetInstance: TZWNetWorkTool = {
        let tool = TZWNetWorkTool()
        tool.responseSerializer.acceptableContentTypes?.insert("text/plain")
    
        return tool
    }()

}
